package com.crl.game.simulation.server
{
	import com.crl.game.simulation.common.Performer;
	import com.crl.game.simulation.common.action.IAction;
	import com.crl.game.simulation.server.decoder.IServerRouter;
	import com.crl.game.simulation.common.event.SimulationEvent;
	import com.crl.game.simulation.common.state.ControlState;
	import com.crl.net.transfer.Command;

	/**
	 * 行动者
	 * @author crl
	 * 
	 */	
	public class Actor extends Performer
	{
		public var defaultControlState:ControlState;
		
		/**
		 * 当前控制状态(是由AI,客户端.或其它脚本动画); 
		 */		
		protected var _currentControlState:ControlState;
		
		public function Actor(id:int)
		{
			super(id);
			
		}
		
		public function get currentControlState():ControlState{
			if(_currentControlState==null){
				_currentControlState=defaultControlState;
			}
			return _currentControlState;
		}
		
		override public function sendCommand(command:Command):void{
			_currentControlState.sendCommand(command);
		}
		
		
		override public function tick(time:int):void{
			_currentControlState.tick(time);
		}
		
		/**
		 * 当侦听对像发布事件时; 
		 * @param event
		 * 
		 */		
		public function handler(event:SimulationEvent):void{
			//_actorEventHandler.handler(event,this);
		}
	}
}